/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author KNO
 */
@Entity
@Table(name = "plan")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Plan.findAll", query = "SELECT p FROM Plan p"),
    @NamedQuery(name = "Plan.findByPlanCod", query = "SELECT p FROM Plan p WHERE p.planCod = :planCod"),
    @NamedQuery(name = "Plan.findByPlanCiclo", query = "SELECT p FROM Plan p WHERE p.planCiclo = :planCiclo")})
public class Plan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "plan_cod")
    private Integer planCod;
    @Column(name = "plan_ciclo")
    private Integer planCiclo;
    @JoinColumn(name = "plan_materia", referencedColumnName = "materia_id")
    @ManyToOne
    private Materia planMateria;
    @JoinColumn(name = "plan_carrera", referencedColumnName = "carr_cod")
    @ManyToOne
    private Carrera planCarrera;

    public Plan() {
    }

    public Plan(Integer planCod) {
        this.planCod = planCod;
    }

    public Integer getPlanCod() {
        return planCod;
    }

    public void setPlanCod(Integer planCod) {
        this.planCod = planCod;
    }

    public Integer getPlanCiclo() {
        return planCiclo;
    }

    public void setPlanCiclo(Integer planCiclo) {
        this.planCiclo = planCiclo;
    }

    public Materia getPlanMateria() {
        return planMateria;
    }

    public void setPlanMateria(Materia planMateria) {
        this.planMateria = planMateria;
    }

    public Carrera getPlanCarrera() {
        return planCarrera;
    }

    public void setPlanCarrera(Carrera planCarrera) {
        this.planCarrera = planCarrera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (planCod != null ? planCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Plan)) {
            return false;
        }
        Plan other = (Plan) object;
        if ((this.planCod == null && other.planCod != null) || (this.planCod != null && !this.planCod.equals(other.planCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Plan[ planCod=" + planCod + " ]";
    }
    
}
